function docheck(form_,opt)
{
	var status=form_.chkall.checked
	var alen=form_.elements.length;
	alen=(alen>2)?form_.Xoa.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			form_.Xoa[i].checked=status;
	}else
	{
			form_.Xoa.checked=status;
	}
	if(opt>0)
		form_.chkall.checked=status;
}
function docheckone(form_)
{
	var alen=form_.elements.length;
	var isChecked=true;
	alen=(alen>2)?form_.Xoa.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.Xoa[i].checked==false)
				isChecked=false;
	}else
	{
		if(form_.Xoa.checked==false)
			isChecked=false;
	}				
	form_.chkall.checked=isChecked;
}
function docheckhuyen(form_,opt)
{
	var status=form_.chkall.checked
	var alen=form_.elements.length;
	alen=(alen>2)?form_.chk_huyen.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			form_.chk_huyen[i].checked=status;
	}else
	{
			form_.chk_huyen.checked=status;
	}
	if(opt>0)
		form_.chkall.checked=status;
}
function docheckonehuyen(form_)
{
	var alen=form_.elements.length;
	var isChecked=true;
	alen=(alen>2)?form_.chk_huyen.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.chk_huyen[i].checked==false)
				isChecked=false;
	}else
	{
		if(form_.chk_huyen.checked==false)
			isChecked=false;
	}				
	form_.chkall.checked=isChecked;
}

function calculatechkhuyen(form_)
{			
	var strchon="";
	var strchon1="";
	var alen=form_.elements.length;				
	alen=(alen>2)?form_.chk_huyen.length:0;
	//alen1=(alen1>2)?form_.chk_huyen1.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.chk_huyen[i].checked==true)
				strchon+=form_.chk_huyen[i].value+",";
	}else
	{
		if(form_.chk_huyen.checked==true)
			strchon=form_.chk_huyen.value;
	}
	/*if (alen1>0)
	{
		for(var i=0;i<alen1;i++)
			if(form_.chk_huyen1[i].checked==true)
				strchon1+=form_.chk_huyen1[i].value+",";
	}else
	{
		
		if(form_.chk_huyen1.checked==true)
			strchon1=form_.chk_huyen1.value;
	}*/
	form_.chon.value=strchon;
	//form_.chon1.value=strchon1;
	
}
function checkInputchkhuyen(form_,strSelect,strConfirm)
{
	var alen=form_.elements.length;
	var isChecked=false;
	alen=(alen>2)?form_.chk_huyen.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.chk_huyen[i].checked==true)
				isChecked=true;
	}else
	{
		if(form_.chk_huyen.checked==true)
			isChecked=true;
	}
	if (!isChecked)						
		alert(strSelect);
	else
	{
		if(strConfirm!='')
		{
			if (confirm(strConfirm))
			{
				isChecked=true;
				calculatechkhuyen(form_);
			}
			else
				isChecked=false;
		}else
		{
			isChecked=true;
			calculatechkhuyen(form_);
		}
	}								
return isChecked;
} 		

function calculatechon(form_)
{			
	var strchon="";
	var alen=form_.elements.length;				
	alen=(alen>2)?form_.Xoa.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.Xoa[i].checked==true)
				strchon+=form_.Xoa[i].value+",";
	}else
	{
		if(form_.Xoa.checked==true)
			strchon=form_.Xoa.value;
	}
	form_.chon.value=strchon;	
	
}
function checkInput(form_,strSelect,strConfirm)
{
	var alen=form_.elements.length;
	var isChecked=false;
	alen=(alen>2)?form_.Xoa.length:0;
	if (alen>0)
	{
		for(var i=0;i<alen;i++)
			if(form_.Xoa[i].checked==true)
				isChecked=true;
	}else
	{
		if(form_.Xoa.checked==true)
			isChecked=true;
	}
	if (!isChecked)						
		alert(strSelect);
	else
	{
		if(strConfirm!='')
		{
			if (confirm(strConfirm))
			{
				isChecked=true;
				calculatechon(form_);
			}
			else
				isChecked=false;
		}else
		{
			isChecked=true;
			calculatechon(form_);
		}
	}								
return isChecked;
} 		  